package cn.zaichi.edu.excelcommon.plugs.validation;

import cn.zaichi.edu.excelcommon.error.ValidatorExceptionEnum;
import cn.zaichi.edu.excelcommon.exception.ValidatorException;
import cn.zaichi.edu.excelcommon.plugs.Validator;

/**
 * 验证邮箱格式
 */
public class EmailValidator implements Validator {

  @Override
  public void valid(Object value) {
    if(value==null){
      return;
    }
    if(!ValidatorUtil.isEmail(value.toString())){
      throw new ValidatorException(ValidatorExceptionEnum.VALIDATOR_EMAIL);
    }

  }

}
